[Top] [Prev] [Next] [Bottom] [Contents]

SaReqAppendError

Adds an error record to the specified request. This is one of the functions to implement FUNCTION objects.

Synopsis

#include "WorkingDialog.h"
int SaReqAppendError(pSgeWorkCallData p, int type, 
int major, int minor, char* msg, int state, int line);

Arguments

p
An allocated pSgeWorkCallData data structure.
type
should be the defined constant, SGEGENERIC, as defined in SaDef.h.
major
major code, generally the error code from the vendor. In a future release this will specify the message set number for the error. This number should be in the range 100 to 256.
minor
minor code, meaning varies. In a future release this will specify the message number within the message set for the error. This number should be in the range 1 to 256.
msg
the message string associated with the error.
state
auxiliary value, user defined.
line
auxiliary value, user defined.

Return Values

Returns 1. Returns 0 if p is NULL.

Description

Adds an error record to the specified request. This is one of the functions to implement FUNCTION objects. This error record will propagate through the Sapphire error management functionality. This will either appear as a message in the client browser or be sent to an error handler that is installed in the cgi.

Example

#include "SaRnHtml.h"

#ifdef _NO_PROTO
int EchoArgs(p)
pSgeWorkCallData p;
#else
int EchoArgs(pSgeWorkCallData p)
#endif
{
    int i, size;
    char* value;
    char* name;
    pSutList options;
    char* str;

    if (!p)
    {
        return 0;
    }
	/****** DO NOT MODIFY list or its contents, read-only. ****/
    options = SaReqGetOptionList(p);
size = SaReqGetNumArgs(p);
    if (size == 0)
    {
        SaReqSetErrorCode(p, 1);
        SaReqSetReturnCode(p, 1);
        SaReqSetAffectedRowCount(p, 0);
        SaReqAppendError(p, SGEGENERIC,0,0,
					"EchoArgs : No args found", 0, 0);
        return 0;
    }
	SaReqAppendString(p, "Hello");
    for(i=0; i<size; i++)
    {
        /**** DO NOT MODIFY, read-only data ****/
        value = SaReqGetNArg(p, i);
        /**** DO NOT MODIFY, read-only data ****/
        name = SaReqGetNArgName(p, i);
      str = (char*) malloc(strlen(name) + strlen(value) + 2);
        sprintf(str, "%s=%s", name, value);
        SaReqAppendString(p, str);
        /**** SaReqAppendString copies in string ****/
        free(str);
		 		/**** DO NOT MODIFY, read-only data ****/
        /**** example, not used here *****/
        value = SaReqGetArgByName(p, name);
    }
	SaReqSetGroupCount(p, 1);
    SaReqAppendRowCount(p, 1);
    SaReqAppendColCount(p, size+1);
    SaReqSetErrorCode(p, 0);
    SaReqSetReturnCode(p, 0);
    SaReqSetAffectedRowCount(p, 1);
    return 1;
}

See Also



[Top] [Prev] [Next] [Bottom] [Contents]

info@bluestone.com
Copyright © 1997, Bluestone. All rights reserved.